package variabilitysmelldetection.measurement.measures.method;

import java.util.List;

import variabilitysmelldetection.measurement.measures.Measure;
import variabilitysmelldetection.measurement.models.ComponentItem;
import variabilitysmelldetection.measurement.models.MethodItem;



public class NumberOfParameters extends Measure {

	public NumberOfParameters() {
		super("Number of Parameters", "NP");
	}

	@Override
	public void measure(List<ComponentItem> items) {
		for (ComponentItem classe : items) {
			measure(classe);
		}
	}	
	
	private void measure(ComponentItem componentItem) {
		for (MethodItem m : componentItem.getMethods()) {
			NumberOfParameters nmp = new NumberOfParameters();
			nmp.setValue(m.getParametersTypes().size());
			m.addMeasure(nmp);
		}
	}	
}
